<html>
<head><meta charset="utf-8"><title>There is a bug! https://github.com/mpizenberg/pubgrub-rs/... · t-cargo/PubGrub · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/index.html">t-cargo/PubGrub</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html">There is a bug! https://github.com/mpizenberg/pubgrub-rs/...</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212642733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212642733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212642733">(Oct 08 2020 at 02:53)</a>:</h4>
<p>Ok so I can't fuzz to make sure two runs have the same output, because it mostly depends on the hashing. That may get fixed tomorrow, but in the meantime, I can test that two runs ether bouth pass or both fail. Something's not right if one passes and one fails. Inspired by a related test in cargo <a href="https://github.com/rust-lang/cargo/blob/master/crates/resolver-tests/tests/resolve.rs#L93">https://github.com/rust-lang/cargo/blob/master/crates/resolver-tests/tests/resolve.rs#L93</a>. Run the proptest code and get a wall of failing. Rerun with the output in ron format, and hand minimize. and here is the case:</p>



<a name="212642735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212642735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212642735">(Oct 08 2020 at 02:53)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">0</span>:<span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">0</span>:<span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="mi">1</span>:<span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span>:<span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="mi">2</span>:<span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">0</span>:<span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="mi">1</span>:<span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="mi">1</span>:<span class="p">[(</span><span class="mi">0</span><span class="p">,</span><span class="nb">Some</span><span class="p">(</span><span class="mi">1</span><span class="p">))]</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="mi">3</span>:<span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">0</span>:<span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="mi">1</span>:<span class="p">[(</span><span class="mi">3</span><span class="p">,</span><span class="nb">None</span><span class="p">)]</span><span class="w"></span>
<span class="w">        </span><span class="p">},</span><span class="w"></span>
<span class="w">        </span><span class="mi">1</span>:<span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="mi">1</span>:<span class="p">[(</span><span class="mi">2</span><span class="p">,</span><span class="nb">None</span><span class="p">)]</span><span class="w"></span>
<span class="w">        </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="mi">4</span>:<span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">0</span>:<span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="mi">2</span>:<span class="p">[(</span><span class="mi">0</span><span class="p">,</span><span class="nb">None</span><span class="p">)],</span><span class="w"></span>
<span class="w">            </span><span class="mi">3</span>:<span class="p">[(</span><span class="mi">0</span><span class="p">,</span><span class="nb">None</span><span class="p">)]</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="212642790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212642790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212642790">(Oct 08 2020 at 02:55)</a>:</h4>
<p>Driven by:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[cfg(feature = </span><span class="s">"serde"</span><span class="cp">)]</span><span class="w"></span>
<span class="cp">#[test]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">err_the_same_1</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">std</span>::<span class="n">fs</span>::<span class="n">read_to_string</span><span class="p">(</span><span class="s">"test-examples/err_the_same_u16_NumberVersion.ron"</span><span class="p">).</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">dependency_provider</span>: <span class="nc">OfflineDependencyProvider</span><span class="o">&lt;</span><span class="kt">u16</span><span class="p">,</span><span class="w"> </span><span class="n">NumberVersion</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"></span>
<span class="w">        </span><span class="n">ron</span>::<span class="n">de</span>::<span class="n">from_str</span><span class="p">(</span><span class="o">&amp;</span><span class="n">s</span><span class="p">).</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>

<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">one</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">resolve</span><span class="p">(</span><span class="o">&amp;</span><span class="n">dependency_provider</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">).</span><span class="n">is_ok</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mi">5</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="n">one</span><span class="p">,</span><span class="w"> </span><span class="n">resolve</span><span class="p">(</span><span class="o">&amp;</span><span class="n">dependency_provider</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">).</span><span class="n">is_ok</span><span class="p">())</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="212642922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212642922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212642922">(Oct 08 2020 at 02:58)</a>:</h4>
<p>Most of the time the <code>resolve</code> returns </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="nb">Ok</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span>: <span class="nc">NumberVersion</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="mi">0</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="mi">1</span>: <span class="nc">NumberVersion</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="mi">2</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="mi">4</span>: <span class="nc">NumberVersion</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="mi">0</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="mi">3</span>: <span class="nc">NumberVersion</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="mi">1</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="p">)</span><span class="w"></span>
</code></pre></div>

<p>but about 1/3 calls return an error. That feels to me like there has to be a bug somewhere.</p>



<a name="212660553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212660553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212660553">(Oct 08 2020 at 08:34)</a>:</h4>
<p>Indeed! I'll have a look at this one tonight</p>



<a name="212662047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212662047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212662047">(Oct 08 2020 at 08:50)</a>:</h4>
<p>Just rewriting it with letters and numbers to make it easier to analyze later</p>
<p>a0 has no dep<br>
b2 has no dep<br>
c0 has no dep<br>
c1 dep on b0<br>
d0 dep on b&gt;=3<br>
d1 dep on b&gt;=2<br>
e0 dep on c and d</p>
<p>Solution: e0, d1, b2, c0</p>



<a name="212664257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212664257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212664257">(Oct 08 2020 at 09:13)</a>:</h4>
<p>Alright, simplified this a bit, we get to that test, that has the same issues as described:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">collections</span>::<span class="n">HashMap</span><span class="p">;</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">pubgrub</span>::<span class="n">error</span>::<span class="n">PubGrubError</span><span class="p">;</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span><span class="n">pubgrub</span>::<span class="n">range</span>::<span class="n">Range</span><span class="p">;</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span><span class="n">pubgrub</span>::<span class="n">report</span>::<span class="p">{</span><span class="n">DefaultStringReporter</span><span class="p">,</span><span class="w"> </span><span class="n">Reporter</span><span class="p">};</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span><span class="n">pubgrub</span>::<span class="n">solver</span>::<span class="p">{</span><span class="n">resolve</span><span class="p">,</span><span class="w"> </span><span class="n">OfflineDependencyProvider</span><span class="p">};</span><span class="w"></span>
<span class="k">use</span><span class="w"> </span><span class="n">pubgrub</span>::<span class="n">version</span>::<span class="n">NumberVersion</span><span class="p">;</span><span class="w"></span>

<span class="cp">#[test]</span><span class="w"></span>
<span class="sd">/// a0 dep on b and c</span>
<span class="sd">/// b0 dep on d0</span>
<span class="sd">/// b1 dep on d1 (not existing)</span>
<span class="sd">/// c0 has no dep</span>
<span class="sd">/// c1 dep on d2 (not existing)</span>
<span class="sd">/// d0 has no dep</span>
<span class="sd">///</span>
<span class="sd">/// Solution: a0, b0, c0, d0</span>
<span class="k">fn</span> <span class="nf">problem</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">dependency_provider</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">OfflineDependencyProvider</span>::<span class="o">&lt;&amp;</span><span class="kt">str</span><span class="p">,</span><span class="w"> </span><span class="n">NumberVersion</span><span class="o">&gt;</span>::<span class="n">new</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"a"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="n">Range</span>::<span class="n">any</span><span class="p">()),</span><span class="w"> </span><span class="p">(</span><span class="s">"c"</span><span class="p">,</span><span class="w"> </span><span class="n">Range</span>::<span class="n">any</span><span class="p">())]);</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">0</span><span class="p">))]);</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">1</span><span class="p">))]);</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"c"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[]);</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"c"</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">2</span><span class="p">))]);</span><span class="w"></span>
<span class="w">    </span><span class="n">dependency_provider</span><span class="p">.</span><span class="n">add_dependencies</span><span class="p">(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[]);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// Solution.</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">expected_solution</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">HashMap</span>::<span class="n">new</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">expected_solution</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="s">"a"</span><span class="p">,</span><span class="w"> </span><span class="mf">0.</span><span class="n">into</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="n">expected_solution</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="mf">0.</span><span class="n">into</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="n">expected_solution</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="s">"c"</span><span class="p">,</span><span class="w"> </span><span class="mf">0.</span><span class="n">into</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="n">expected_solution</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="mf">0.</span><span class="n">into</span><span class="p">());</span><span class="w"></span>

<span class="w">    </span><span class="c1">// Run the algorithm.</span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mi">10</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">match</span><span class="w"> </span><span class="n">resolve</span><span class="p">(</span><span class="o">&amp;</span><span class="n">dependency_provider</span><span class="p">,</span><span class="w"> </span><span class="s">"a"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="nb">Ok</span><span class="p">(</span><span class="n">computed_solution</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="n">expected_solution</span><span class="p">,</span><span class="w"> </span><span class="n">computed_solution</span><span class="p">),</span><span class="w"></span>
<span class="w">            </span><span class="nb">Err</span><span class="p">(</span><span class="n">PubGrubError</span>::<span class="n">NoSolution</span><span class="p">(</span><span class="n">derivation_tree</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">panic</span><span class="o">!</span><span class="p">(</span><span class="s">"{}"</span><span class="p">,</span><span class="w"> </span><span class="n">DefaultStringReporter</span>::<span class="n">report</span><span class="p">(</span><span class="o">&amp;</span><span class="n">derivation_tree</span><span class="p">));</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="nb">Err</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">panic</span><span class="o">!</span><span class="p">(</span><span class="s">"{:?}"</span><span class="p">,</span><span class="w"> </span><span class="n">err</span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>

<p>Don't hesitate to have a try at figuring it out. I'll have a try tonight</p>



<a name="212671708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212671708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Tokarev <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212671708">(Oct 08 2020 at 10:38)</a>:</h4>
<blockquote>
<p>Don't hesitate to have a try at figuring it out.</p>
</blockquote>
<p>If only I could work on this full time :D</p>



<a name="212697750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212697750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212697750">(Oct 08 2020 at 14:28)</a>:</h4>
<p>If you find that job, can I get highered too?</p>



<a name="212699118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212699118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212699118">(Oct 08 2020 at 14:37)</a>:</h4>
<p>the report is </p>
<div class="codehilite"><pre><span></span><code>Because there is no version of b in 2 &lt;= v and b 0 depends on d 0, b [ 0, 1 [  [ 2, ∞ [ depends on d 0.
And because b 1 depends on d 1 and a 0 depends on b, a 0 is forbidden.
</code></pre></div>


<p><span class="user-mention" data-user-id="348419">@Matthieu Pizenberg</span> Do you have advice on how to start debugging?</p>



<a name="212705401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212705401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212705401">(Oct 08 2020 at 15:17)</a>:</h4>
<p>I think it's an instance of a bug I've been chasing for quite some time. I'll let you know where to put some <code>println</code> as a start</p>



<a name="212706646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212706646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212706646">(Oct 08 2020 at 15:25)</a>:</h4>
<p>So it's an issue related to computation of prior causes. So the first thing I'd do is uncomment and slightly change the three commented lines in <code>core.rs</code>just after computation of prior cause. Something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">eprintln</span><span class="o">!</span><span class="p">(</span><span class="s">"</span><span class="se">\n</span><span class="s">cause 1: {}"</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">current_incompat</span><span class="p">);</span><span class="w"></span>
<span class="n">eprintln</span><span class="o">!</span><span class="p">(</span><span class="s">"cause 2: {} (satisfier)"</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">cause</span><span class="p">);</span><span class="w"></span>
<span class="n">eprintln</span><span class="o">!</span><span class="p">(</span><span class="s">"prior cause: {}</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">prior_cause</span><span class="p">);</span><span class="w"></span>
</code></pre></div>

<p>and add a <code>eprintln!("backtrack");</code> in <code>core::State::backtrack</code> function to cover all branches of conflict resolution</p>



<a name="212708290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212708290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212708290">(Oct 08 2020 at 15:36)</a>:</h4>
<p>If you do this, at some point in there will be something like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">cause</span><span class="w"> </span><span class="mi">1</span>: <span class="nc">b</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">[</span><span class="w">  </span><span class="p">[</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="err">∞</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="n">depends</span><span class="w"> </span><span class="n">on</span><span class="w"> </span><span class="n">d</span><span class="w"> </span><span class="mi">0</span><span class="w"></span>
<span class="n">cause</span><span class="w"> </span><span class="mi">2</span>: <span class="nc">b</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="n">depends</span><span class="w"> </span><span class="n">on</span><span class="w"> </span><span class="n">d</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">(</span><span class="n">satisfier</span><span class="p">)</span><span class="w"></span>
<span class="n">prior</span><span class="w"> </span><span class="n">cause</span>: <span class="nc">b</span><span class="w"> </span><span class="err">∗</span><span class="w"> </span><span class="n">is</span><span class="w"> </span><span class="n">forbidden</span><span class="w"></span>
</code></pre></div>

<p>This is a weird situation because we have to compute prior cause something in the form of { a1, not b1} with something of the form {a2, not b2} which will result in something of the form {a1 union a2, not b1 union not b2}, with the "not b1 union not b2" that may return "not none" which is always satisfied and thus removed from the incompatibility. Leaving us with the "a1 union a2" side, which here is "b * is forbidden" , i.e. { b: any }</p>



<a name="212708643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212708643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212708643">(Oct 08 2020 at 15:38)</a>:</h4>
<p>The issue here comes either from the fact that the two causes are not good, or from the fact that prior computation is not good.<br>
And these corresponds to places where we might have some misinterpretation of my part from pubgrub description on github. Specifically ...</p>



<a name="212709462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212709462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212709462">(Oct 08 2020 at 15:44)</a>:</h4>
<p>The documentation uses <code>incompatibility</code> everywhere for things that are function arguments and mutated in place. In particular, in unit propagation (<a href="https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation">https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation</a>) it says to "run conflict resolution with incompatibility" and later "Add not term to the partial solution with incompatibility as its cause" whereas meanwhile conflict resolution also uses the word <code>incompatibility</code> and mutates it in place with prior causes. I have not looked at dart code, but from my tests in elm, it "worked" (most of the time) when I used the root cause returned by conflict resolution as its cause. And when it didn't (this very bug) changing to the original incompatibility would not solve it.</p>
<p>BUT, that may be a side effect of the second place where interpretation plays a role in that document ...</p>



<a name="212710693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212710693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212710693">(Oct 08 2020 at 15:53)</a>:</h4>
<p>At the end of the conflict resolution algorithm (<a href="https://github.com/dart-lang/pub/blob/master/doc/solver.md#conflict-resolution">https://github.com/dart-lang/pub/blob/master/doc/solver.md#conflict-resolution</a>) there is an explanation of how to compute a prior cause, and it is pretty confusing. While the general text above says things pretty clear like</p>
<blockquote>
<p>In fact, we can generalize this: given any incompatibilities {t1, q} and {t2, r}, we can derive {q, r, t1 ∪ t2}</p>
</blockquote>
<p>the actual algorithm description does something very twisted, using new type of operations like the set <code>\</code> as in <code>not (satisfier \ term)</code>. Every time I've tried to analyze this deeply I came to the conclusion that all operations with the terms of that package are the same than doing <code>term union not(satisfier)</code> and remove it if that becomes <code>not none</code> which is always satisfied. And that itself was the same as just doing the union of all the terms in the two causes (but I may be wrong here) and applying the same removal for other packages always satisfied.</p>



<a name="212710994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212710994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212710994">(Oct 08 2020 at 15:55)</a>:</h4>
<p>I'm pretty sure I've done every variation that may be a correct interpretation of those things. But I've never looked at the dart code so ... maybe the key is here</p>



<a name="212711292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711292">(Oct 08 2020 at 15:57)</a>:</h4>
<p>Or maybe, this is not a problem in unit propagation or conflict resolution but a side effect of a problem somewhere else. But that's why I've put a lot of property testing of the other base components of this algorithm like range, or term.</p>
<p>I hope that since you have a fresh eye on this, you'll see what I didn't</p>



<a name="212711348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711348">(Oct 08 2020 at 15:57)</a>:</h4>
<p>This all sounds like it has been a lot of work on your part and very frustrating.</p>



<a name="212711444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711444">(Oct 08 2020 at 15:58)</a>:</h4>
<p>Yes that has been frustration number 1 ahah</p>



<a name="212711609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711609">(Oct 08 2020 at 15:59)</a>:</h4>
<p>And exactly why I want fuzz testing on as much as possible. It is so hard to look at an algorithm (in words or code) and be sure it is correct.</p>



<a name="212711634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711634">(Oct 08 2020 at 15:59)</a>:</h4>
<p>And before you came up with that example, everywhere I had seen this manifest, saying there was no solution was actually the right answer, even if the reason it found didn't make much sense</p>



<a name="212711816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212711816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212711816">(Oct 08 2020 at 16:00)</a>:</h4>
<p>So I was in doubt, but thinking, maybe it works but the slight variations I have make it so the explanation is a bit weird</p>



<a name="212712008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212712008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212712008">(Oct 08 2020 at 16:02)</a>:</h4>
<p>In a way, it's almost a satisfaction that you proved it's a bug. I'm not in doubt anymore ahah</p>



<a name="212712813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212712813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212712813">(Oct 08 2020 at 16:07)</a>:</h4>
<p>That is a relief. I was worried you'd be upset. I was pretty upset when proptest found its first bug in stable functionality in Cargo, and I was the one that wrote the test.</p>



<a name="212713155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212713155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212713155">(Oct 08 2020 at 16:09)</a>:</h4>
<p>Don't worry, I'm dealing with researcher code on a daily basis, I'm used to things being broken in very subtle algorithmic ways ^^. It's way better to have a simple example of why that's broken</p>



<a name="212713702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212713702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212713702">(Oct 08 2020 at 16:13)</a>:</h4>
<p>so far I added the <code>eprintln</code> you suggested. Still figuring out what it means.</p>
<div class="codehilite"><pre><span></span><code>start

cause 1: b 2 &lt;= v is forbidden
cause 2: b 0 depends on d 0
prior cause: b [ 0, 1 [  [ 2, ∞ [ depends on d 0


cause 1: b [ 0, 1 [  [ 2, ∞ [ depends on d 0
cause 2: b 1 depends on d 1
prior cause: b ∗ is forbidden


cause 1: b ∗ is forbidden
cause 2: a 0 depends on b
prior cause: a 0 is forbidden

thread &#39;problem&#39; panicked at &#39;Because there is no version of b in 2 &lt;= v and b 0 depends on d 0, b [ 0, 1 [  [ 2, ∞ [ depends on d 0.
And because b 1 depends on d 1 and a 0 depends on b, a 0 is forbidden.&#39;
</code></pre></div>



<a name="212714005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212714005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212714005">(Oct 08 2020 at 16:15)</a>:</h4>
<p>those are the two incompatibilities used to compute a prior cause incompatibility in one step of the conflict resolution loop</p>



<a name="212715029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212715029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212715029">(Oct 08 2020 at 16:22)</a>:</h4>
<p>As I am reading it:</p>
<div class="codehilite"><pre><span></span><code>cause 1: b [ 0, 1 [  [ 2, ∞ [ depends on d 0
cause 2: b 1 depends on d 1
prior cause: b ∗ is forbidden
</code></pre></div>


<p>is just wrong. <br>
cause 1: I read as <code>b</code> not v1 depends on <code>d0</code>, which is an odd way of saying it but is true.<br>
cause 2: I read as  <code>b1</code>depends on <code>d1</code>, witch is straightforwardly true.<br>
prior cause: is just wrong. and does not follow.</p>



<a name="212717309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717309">(Oct 08 2020 at 16:41)</a>:</h4>
<p>So the first one would read "Every version of b except version 1 depend on d0"</p>



<a name="212717339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717339">(Oct 08 2020 at 16:41)</a>:</h4>
<p>and that is true</p>



<a name="212717495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717495">(Oct 08 2020 at 16:42)</a>:</h4>
<p>It's just that I didn't implement a check for such situation so it just prints the segments (which are equivalent to every of except 1)</p>



<a name="212717627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717627">(Oct 08 2020 at 16:43)</a>:</h4>
<p>Yes. That makes sence.</p>



<a name="212717634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717634">(Oct 08 2020 at 16:43)</a>:</h4>
<p>As for the prior cause, it's indeed not logical, but that's what computing the union of terms gives</p>



<a name="212717761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717761">(Oct 08 2020 at 16:44)</a>:</h4>
<p>99% of the time, we have {a, not b} and {b, not c} as in "a depends on b" and "b depends on c"</p>



<a name="212717917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212717917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212717917">(Oct 08 2020 at 16:45)</a>:</h4>
<p>the union of all terms give {a, b union not(b), c}, but "b union not(b)" resolves to "not none" which is always satisfied so it is removed</p>



<a name="212718102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212718102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212718102">(Oct 08 2020 at 16:47)</a>:</h4>
<p>That's what says <strong>the rule of resolution</strong> explained here: <a href="https://github.com/dart-lang/pub/blob/master/doc/solver.md#conflict-resolution">https://github.com/dart-lang/pub/blob/master/doc/solver.md#conflict-resolution</a></p>



<a name="212718132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212718132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212718132">(Oct 08 2020 at 16:47)</a>:</h4>
<p>It might take some time to digest it all</p>



<a name="212718606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212718606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212718606">(Oct 08 2020 at 16:50)</a>:</h4>
<p>I think the next step for me, is to make a test that directly calls <code>Incompatibility::union</code> with that one case.  Well actually I have a meeting in 10, witch will make me mad, so then I will need a walk. Then I will try to redigest that reading materials vis this case.</p>



<a name="212719249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212719249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212719249">(Oct 08 2020 at 16:55)</a>:</h4>
<p>But sometimes, the search for a satisfier (whose incompatibility cause is used for computation of the prior cause) makes us work with to incompats of the form {a1, b1} {a2, b2} where both incompats refer to the same packages. And it gets weird when a1 and a2 are different. So I think I'd rather argue that it does not makes sense to use those two incompats to compute a prior cause but that would mean that it's the search for the previous satisfier that's wrong, and I've read it multiple times</p>



<a name="212719495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212719495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212719495">(Oct 08 2020 at 16:57)</a>:</h4>
<p>Fuzzing the satisfier search would be great, but I'm not sure how to do that. Anyway the best solution is maybe just have a look at the dart implementation on those very points</p>



<a name="212724594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212724594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212724594">(Oct 08 2020 at 17:37)</a>:</h4>
<p>ooohh, I've just had a quick look at dart pub implementation. I'm seeing an intersection here where terms of the two causes used for prior cause are merged: <a href="https://github.com/dart-lang/pub/blob/23a59a380cdc88aca6a50f9b0147ecdd3b948919/lib/src/solver/incompatibility.dart#L68">https://github.com/dart-lang/pub/blob/23a59a380cdc88aca6a50f9b0147ecdd3b948919/lib/src/solver/incompatibility.dart#L68</a><br>
That might be the reason ...<br>
Have to go now, so I'll continue looking later but seems promising</p>



<a name="212725277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212725277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212725277">(Oct 08 2020 at 17:42)</a>:</h4>
<p>Good find!<br>
In case it is helpful here is the isolated test case I was working on:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="cp">#[test]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">bad_union</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">use</span><span class="w"> </span><span class="k">crate</span>::<span class="n">version</span>::<span class="n">NumberVersion</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">i1</span>: <span class="nc">Map</span><span class="o">&lt;&amp;</span><span class="kt">str</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span><span class="o">&lt;</span><span class="n">NumberVersion</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="w"></span>
<span class="w">            </span><span class="p">(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span>::<span class="n">Negative</span><span class="p">(</span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">0</span><span class="p">))),</span><span class="w"></span>
<span class="w">            </span><span class="p">(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span>::<span class="n">Positive</span><span class="p">(</span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="n">negate</span><span class="p">())),</span><span class="w"></span>
<span class="w">        </span><span class="p">]</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">cloned</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">collect</span><span class="p">();</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">i2</span>: <span class="nc">Map</span><span class="o">&lt;&amp;</span><span class="kt">str</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span><span class="o">&lt;</span><span class="n">NumberVersion</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="w"></span>
<span class="w">            </span><span class="p">(</span><span class="s">"d"</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span>::<span class="n">Negative</span><span class="p">(</span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">1</span><span class="p">))),</span><span class="w"></span>
<span class="w">            </span><span class="p">(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span>::<span class="n">Positive</span><span class="p">(</span><span class="n">Range</span>::<span class="n">exact</span><span class="p">(</span><span class="mi">1</span><span class="p">))),</span><span class="w"></span>
<span class="w">        </span><span class="p">]</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">cloned</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">collect</span><span class="p">();</span><span class="w"></span>

<span class="w">        </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="p">[(</span><span class="s">"b"</span><span class="p">,</span><span class="w"> </span><span class="n">Term</span>::<span class="n">Positive</span><span class="p">(</span><span class="n">Range</span>::<span class="o">&lt;</span><span class="n">NumberVersion</span><span class="o">&gt;</span>::<span class="n">any</span><span class="p">()))]</span><span class="w"></span>
<span class="w">                </span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
<span class="w">                </span><span class="p">.</span><span class="n">cloned</span><span class="p">()</span><span class="w"></span>
<span class="w">                </span><span class="p">.</span><span class="n">collect</span>::<span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">_</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="o">&gt;&gt;</span><span class="p">(),</span><span class="w"></span>
<span class="w">            </span><span class="n">Incompatibility</span>::<span class="k">union</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">i1</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">i2</span><span class="p">,</span><span class="w"> </span><span class="n">Kind</span>::<span class="n">DerivedFrom</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">)).</span><span class="n">package_terms</span><span class="w"></span>
<span class="w">        </span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>

<p>If we decide that is at fault.</p>



<a name="212733119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212733119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212733119">(Oct 08 2020 at 18:45)</a>:</h4>
<p>Test is passing :)</p>
<p>I'll clean up a bit my mess and make a PR</p>



<a name="212733852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212733852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212733852">(Oct 08 2020 at 18:51)</a>:</h4>
<p>I look forward to reading the explanation, and fuzzing more!</p>



<a name="212734136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212734136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212734136">(Oct 08 2020 at 18:53)</a>:</h4>
<p>Explanation is basically I had the wrong assumptions about what the following meant</p>
<blockquote>
<p>let priorCause be the union of the terms in incompatibility and the terms in satisfier's cause</p>
</blockquote>



<a name="212734923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212734923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Tokarev <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212734923">(Oct 08 2020 at 19:00)</a>:</h4>
<p>Great job <span class="user-mention" data-user-id="348419">@Matthieu Pizenberg</span> for solving this and <span class="user-mention" data-user-id="120179">@Eh2406</span> for reporting and submitting test cases!<br>
Looks like I wasn't on time to participate with this much. At least I managed to make determinism PR satisfactory while you were busy here :)</p>



<a name="212735394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212735394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Tokarev <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212735394">(Oct 08 2020 at 19:04)</a>:</h4>
<p>I think we should make a test case that reproduces this on top of determinism PR. I'll check if the test submitted by <span class="user-mention" data-user-id="120179">@Eh2406</span> fails when using <code>rustc-hash</code> hash function.</p>



<a name="212736071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736071">(Oct 08 2020 at 19:10)</a>:</h4>
<p>Note that the original version (and the one I can use for fuzzing) will always pass with any form of determinism. N calles will always return the same thing. We will need better properties to know if it is the correct thing.</p>



<a name="212736082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Tokarev <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736082">(Oct 08 2020 at 19:10)</a>:</h4>
<p>Unfortunately both original with RON and minified pass. <span class="user-mention" data-user-id="120179">@Eh2406</span> How did you generate the first test case? Maybe I could make one that would fail with <code>rustc-hash</code>.</p>



<a name="212736294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Tokarev <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736294">(Oct 08 2020 at 19:12)</a>:</h4>
<p>Yeah I see. I thought one of them produces Err solution from time to time.</p>



<a name="212736636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736636">(Oct 08 2020 at 19:15)</a>:</h4>
<p>Right, without determinism we can check if <code>run1.is_ok() == run2.is_ok()</code>and find a bug when it is not. With determinism we can check <code>run1 == run2 </code> and have it always pass.</p>



<a name="212736641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736641">(Oct 08 2020 at 19:15)</a>:</h4>
<p>That test case was found thanks to the awesome property of not being reproducible lol.<br>
Well it's true, but I'm kidding here since we do want to be able to reproduce people bugs</p>



<a name="212736836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736836">(Oct 08 2020 at 19:17)</a>:</h4>
<p>The only reason to let a user pick the hasher (that I can think of) is to have the proptest:<br>
<code>run_with_hash_1.is_ok() == run_with_hash_2.is_ok()</code></p>



<a name="212736949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212736949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212736949">(Oct 08 2020 at 19:18)</a>:</h4>
<p>But it is not worth threading a HashBuilder type everyware.</p>



<a name="212738887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212738887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212738887">(Oct 08 2020 at 19:33)</a>:</h4>
<p><a href="https://github.com/mpizenberg/pubgrub-rs/pull/23">https://github.com/mpizenberg/pubgrub-rs/pull/23</a> fix :)</p>



<a name="212739031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212739031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212739031">(Oct 08 2020 at 19:34)</a>:</h4>
<p>I will try the fuzz test on it, before we have a chance to merge the determinism.</p>



<a name="212740143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212740143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212740143">(Oct 08 2020 at 19:44)</a>:</h4>
<p>Rebased, and running 3 times its passing</p>



<a name="212811842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/There%20is%20a%20bug%21%20https%3A//github.com/mpizenberg/pubgrub-rs/.../near/212811842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/There.20is.20a.20bug!.20https.3A.2F.2Fgithub.2Ecom.2Fmpizenberg.2Fpubgrub-rs.2F.2E.2E.2E.html#212811842">(Oct 09 2020 at 11:22)</a>:</h4>
<p>I did a little write up of my thoughts on the prior cause computation with incompatibilities. It's a bit "mathy" but I hope it is still clear: <a href="https://github.com/mpizenberg/pubgrub-rs/pull/23#issuecomment-706122058">https://github.com/mpizenberg/pubgrub-rs/pull/23#issuecomment-706122058</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>